var app = getApp();
Page({
    data: {
        userInfo: [],
    },
    onLoad: function () {
        this.setData({
            userInfo: app.globalData.userInfo
        })
    },
    zhaohezuo: function (e) {
        if (e.detail.value.info.replace(/(^\s*)|(\s*$)/g, "") == "") {
            wx.showToast({
                title: '请输入合作详情',
                image: "../../image/cancel.png",
            })
        } else {
            wx.showLoading({
                title: '上传中',
                duration: 100000
            })
            var data = [];
            data["openid"] = app.globalData.openid;
            data["name"] = this.data.userInfo.nickname;
            data["phone"] = this.data.userInfo.mobile;
            data["wechat"] = this.data.userInfo.email;
            data["info"] = e.detail.value.info;

            data["name"] = data["name"].replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g, "");
            data["info"] = data["info"].replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g, "");

            wx.request({
                url: app.globalData.API_Base_URL + "/zhaohezuo/index/zhaohezuo",
                data: data,
                success: function (res) {
                    if (res.data == 0) {
                        wx.showToast({
                            title: '已提交',
                            duration: 1500,
                        })
                        setTimeout(function () {
                            wx.navigateBack({
                                delta: 1
                            })
                        }, 1000)
                    } else {
                        wx.showToast({
                            title: '上传失败',
                            image: "../../image/cancel.png",
                            duration: 800
                        })
                    }
                }
            })
        }
    }
})